import {customeStruct} from '../utils';
const itf = customeStruct.interface;

export const InitDataStruct = itf({
    payload: itf({
        brands: [itf(Object.assign({
            id: 'string',
            code: 'string',
            name: 'string',
        }))],
    })
});

const content = {
    id: 'string',
    code: 'string',
    dealerCode: 'string? | null',
    partSaleOrderCodes: 'string? | null',
    paymentType: 'number? | null',
    shipmentType: 'number? | null',
    priceTerms: 'number? | null',
    invoiceAmount: 'number? | null',
    freight: 'number? | null',
    status: 'number? | null',
    insurance: 'number? | null',
    totalDiscount: 'number? | null',
    itemCount: 'number? | null',
    totalQuantity: 'number? | null',
    totalAmount: 'number? | null',
    invoicedDate: 'datetime? | null'
};

export const List = itf({
    payload: itf({
        content: [itf(Object.assign(content))]
    })
});

export const Detail = itf({
    payload: itf({
        sapOrderCode: 'string? | null',
        sapDeliveryCode: 'string? | null',
        invoiceCode: 'string? | null',
        currency: 'number? | null',
        cost: 'number? | null',
        invoiceAmount: 'number? | null',
        invoiceCurrency: 'number? | null',
        details: [
            itf({
                partId: 'string',
                partCode: 'string',
                partName: 'string',
                quantity: 'number? | null',
                cif: 'number? | null',
                discountFee: 'number? | null',
                bonusFee: 'number? | null',
                claimFee: 'number? | null',
                declarationDiffFee: 'number? | null',
                otherFee: 'number? | null',
                exchangeDiffFee: 'number? | null',
                rebateFee: 'number? | null',
                cost: 'number? | null',
            })
        ]
    })
});

const dealer = {
    id: 'string',
    code: 'string',
    name: 'string'
};

export const DealerList = itf({
    payload: itf({
        content: [itf(dealer)]
    })
});

export const DealerSimpleList = itf({
    payload: itf({
        content: [
            itf({
                id: 'string',
                code: 'string',
                name: 'string'
            })
        ]
    })
});
